package com.demo.command;

import com.demo.global.LimitedPlayerData;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;

/**
 * 登录命令执行器
 *
 * @author codefish
 * @version 1.0
 * @date 2022/05/03 上午 09:50
 */
public class LoginCommander implements CommandExecutor {
    @Override
    public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
        if(args.length != 1){
            return false;
        }
        if("123456".equals(args[0])){
            commandSender.sendMessage("登录成功!");
            LimitedPlayerData.removePlayer(commandSender.getName());
        }else {
            commandSender.sendMessage("密码错误!");
        }
        return true;
    }
}
